package com.huiyi.ai.server.modules.deepseekdoctor.controller;


import com.huiyi.ai.server.common.bean.ChatEntity;
import com.huiyi.ai.server.common.service.OllamaService;
import com.huiyi.ai.server.modules.deepseekdoctor.service.ChatRecordService;
import com.huiyi.ai.server.modules.deepseekdoctor.service.MyDoctorService;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.springframework.ai.ollama.OllamaChatClient;
import org.springframework.web.bind.annotation.*;

/**
 * @ClassName MyDeepseekDoctorController
 * @Author robin
 * @Version 1.0
 * @Description HelloController
 **/
@Slf4j
@RestController
@RequestMapping("mydoctor")
@Tag(name = "MyDeepseekDoctorController", description = "我的智能家庭医生控制器")
public class MyDeepseekDoctorController {

    @Resource
    private OllamaChatClient ollamaChatClient;

    @Resource
    private MyDoctorService myDoctorService;

    @Resource
    private ChatRecordService chatRecordService;

    @PostMapping("/ai/v3/doctor/stream")
    public void aiOllamaV3DoctorStream(@RequestBody ChatEntity chatEntity) {

        log.info(chatEntity.toString());
        String userName = chatEntity.getCurrentUserName();
        String message = chatEntity.getMessage();

        myDoctorService.doDoctorStreamV3(userName, message);
    }

    @GetMapping("getRecords")
    public Object getDoctorRecords(@RequestParam String who) {
        return chatRecordService.getChatRecordList(who);
    }

}
